const {con} = require('../db/db');

async function userRegister(username,password,email,create_time) {
    const sql_search = `select email from user where email="${email}"`;

    let [rows] = await con.execute(sql_search);

    if(rows.length !== 0) {
        return 'false1';
    }

    const sql_insert = `insert into user(username,password,email,create_time) 
        values("${username}","${password}","${email}","${create_time}");`;

    await con.execute(sql_insert);

    return true;
}

module.exports={
    userRegister
}